<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>01_方式一-CSS-填充-fill</title>
    <link rel="stylesheet" href="style.css" />
    <style>
      body,
      ul {
        margin: 0;
        padding: 0;
      }

      body {
        background-image: url(../../images/grid.png);
      }
      svg {
        background-color: rgba(255, 0, 0, 0.1);
      }

      .rectangle {
        fill: blue;
      }
    </style>
  </head>
  <body>
    <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
      <!-- 行内样式 -->
      <rect x="10" y="10" width="100" height="100" style="fill: red"></rect>
    </svg>

    <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
      <defs>
        <style>
          rect {
            fill: red;
          }
        </style>
      </defs>
      <rect x="10" y="10" width="100" height="100"></rect>
    </svg>

    <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
      <rect x="10" y="10" width="100" height="100" class="rectangle"></rect>
    </svg>

    <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
      <rect
        x="10"
        y="10"
        width="100"
        height="100"
        class="rectangle-fill"
      ></rect>
    </svg>
  </body>
</html>
